The present invention relates in general to a contact type of IC card which reads/writes data through a particular terminal, or a non-contact type of IC card which reads/writes data through a radio interface. More particularly, this invention relates to a technology for normally restoring data and a message relating to an interrupted processing if the processing is stopped due to the interruption of the supply of power or the supply of radio wave or if data which is being received is discontinued and the processing is then resumed.
In recent years, IC cards each including a CPU and having a higher capacity than that of a magnetic card have been introduced in many places. The IC card has been studied as a successor to the magnetic card and gradually employed as, for example, a credit card or a personal card for storing welfare/health data. In the future, it is expected to spread IC cards each of which can be used as a multifunctional card system allowing a single card to fulfill the functions of various types of cards or a card system allowing a user to receive more services in cooperation with other card service businesses.
The operation of a conventional IC card will be described here. A contact IC card, for example, is supplied with power from a host apparatus through a power terminal and operates an IC chip in the IC card. A non-contact IC card, on the other hand, is supplied with radio wave from a host apparatus, converts the received wave into power in the IC card and operates an IC chip.
The data write processing flow of the conventional IC card will be described. FIG. 11 is a flow chart showing a data write processing flow. First, a host apparatus transmits an update command (including update data) to the IC card (in a step S101). The host apparatus then turns into a state of waiting for a response from the IC card.
The IC card receives the update command from the host apparatus (in a step S102), and searches for a place where data is to be updated based on control information (which is pointer information indicating up to which region data was written in a previous processing) stored within the IC card (in a step S103). At this moment, the IC card writes update data to the next region (or address) to that of the previous data stores in a memory region (in a step S104). After completing writing data, the IC card updates the control information (in a step S105) and further transmits a response indicating that a write processing was normally ended, to the host apparatus (in a step S106).
Finally, the host apparatus receives the response from the IC card with which the host apparatus communicates and previously transmitted the update command, and ends a series of data write processings (in a step S107).
In this way, the conventional IC card rewrites data under the control of the host apparatus, whereby the data stored in the memory such as credit card information, personal information for storing welfare/health data and charge information, can be always held in an update state.
In IC cards in general, however, power may possibly be stopped during a write processing for some reason. If so, the operation of the IC card is stopped. In case of the contact IC card, for example, this may be because the supply of power from the host apparatus is interrupted due to some trouble, a contact failure occurs to a power supply terminal, the IC card is released (including a case where the IC card is purposely released) or the like. In case of the non-contact IC, by contrast, this may be because the supply of radio wave from the host apparatus is interrupted due to some trouble, an IC card user is away from areas radio waves can reach or the like.
In the above case, the supply of power to the conventional IC card is interrupted and the processing is stopped halfway. The host apparatus cannot grasp up to which processing the IC card has carried out and from which processing the host apparatus allows the IC card to carry out when the IC card is restarted. As a result, the conventional IC card is confronted with a disadvantage in that the data written in the IC card which data the host apparatus recognizes and the data actually written to the IC card contradicts.
FIG. 12 illustrates a problem in a case where old data of five bytes already stored in the IC card is updated to new data of five bytes. In FIG. 12, it is particularly assumed that the supply of power to the IC card is stopped while data is being written to the IC card or the IC card cannot receive data from the host apparatus. For example, if the supply of power is stopped when data of the third byte has been written to the IC card, a data write processing is ended at that point. As a result, the data which has been written the moment the data write processing is stopped differs from what should be originally written to the IC card.
FIG. 13 shows a concrete example of the above-stated problem. Time zones in which the supply of power is stopped may be the following three zones. The first time zone is one, as shown in {circle around (1)} in FIG. 13, before the IC card recognizes an update command, i.e., the supply of power is stopped before a write operation is started. In the first case, if power supply is recovered and restarted, the IC card can read the state of control information before the supply of power is stopped. However, since the write processing is not completed when the supply of power is stopped, the IC card cannot transmit a response signal for notifying the host apparatus of this state. The second time zone is one, as shown in {circle around (2)}, in which the supply of power is stopped while data is being written to the IC card. In this case as in the case of (1), the IC card can read the previous state of control information when the IC card is restarted but cannot transmit a response signal to the host card. The third time zone is one, as shown in {circle around (3)}, in which the supply of power is stopped after a data update processing is finished and new control information is written. In the third case as in the case of (1) and (2), the IC card can read the new state of control information when the IC card is restarted but cannot transmit a response signal to the host apparatus.
It is an object of the present invention to provide an IC card, a data update control method, a data/message restoration control method and a recording medium storing a control program capable of normally restoring a processing which was executed until the operation of the IC card is stopped when the IC card is restarted even if the supply of power (to the contact IC card) or the supply of radio wave (to the non-contact IC card) is stopped for some reason.
The IC card according to one aspect of this invention comprises a first storage region in which written data is not guaranteed; a second storage region in which the written data is guaranteed; a third storage region in which a status bit indicating a processing state is stored; and a processing section. When the processing section receives a first command to write the data without guarantee from a host apparatus, it sets the status bit corresponding to a write processing at a state indicating a non-guarantee write processing and writes the received data to the first storage region. On the other hand, when processing section receives a second command to write data with guarantee from the host apparatus, it sets the status bit corresponding to the write processing at a state indicating a guarantee write processing and writes the received data to the second storage region.
According to the above-mentioned aspect, one of xe2x80x9cthe data guarantee regionxe2x80x9d and xe2x80x9cthe data non-guarantee regionxe2x80x9d is designated using a predetermined command, thereby guaranteeing important data relating to operations between the host apparatus and the IC card. Thus, even if the supply of power (to the contact IC card) or the supply of radio wave (to the non-contact IC card) is stopped for some reason, for example, it is possible to normally restore the processing executed until the operation of the IC card was stopped when restarting the IC card.
The IC card according to another aspect of this invention comprises a data storage region; a control information storage region; a status bit storage region storing a status bit indicating a processing state; and a processing section. When the processing section receives a command to write data from a host apparatus, it sets the status bit corresponding to a write processing at a processing start state, sets the status bit at a processing end state after finishing writing the data based on the control information, and transmits a response message indicating that the write processing was normally ended to the host apparatus; and in restarting the IC card after the write processing is interrupted, the processing section transmits an error signal to the host apparatus if the status bit is set at the processing start state, and transmits the response message indicating processing end to the host apparatus if the status bit is set at the processing end state.
According to the above-mentioned aspect, if the supply of power (to the contact IC card) or the supply of radio wave (to the non-contact IC card) is stopped for some reason, for example, the IC card notifies the host apparatus of xe2x80x9cinformation indicating that a previous processing resulted in an errorxe2x80x9d or xe2x80x9cinformation indicating that the previous processing was normally endedxe2x80x9d when the IC card is restarted. Thus, no contradiction in recognition occurs between the host apparatus and the IC card. Further, if the status bit represents a normal end state, it is possible to normally restore the data and message relating to the processing when the IC card was interrupted.
The IC card according to still another aspect of this invention comprises a data storage region; a restart point storage region storing restart point information indicating a position at which a processing is to be restarted; a saving region temporarily saving the restart point; a status bit storage region storing a status bit indicating a processing state; and a processing section. When the processing section receives a command to write data from a host apparatus, it moves the restart point information stored in the restart point storage region to the saving region, and writes a command serial number included in the command to the restart point storage region as restart point information, sets the status bit at a processing end state after completion of writing the data, and transmits a response message indicating that the processing was normally ended to the host apparatus; and in restarting the IC card after the write processing is interrupted, the processing section notifies the host apparatus of the status bit and the restart point processing in accordance with the state of the status bit as a response message.
According to the above-mentioned aspect, if the supply of power (to the contact IC card) or the supply of radio wave (to the non-contact IC card) is stopped for some reason, for example, the host apparatus automatically transmits a restart command when restarting the IC card and the IC card which receives the restart command notifies the host apparatus of the processing status and the restart point information in accordance with the place where the supply of power was stopped. Thus, no contradiction in recognition occurs between the host apparatus and the IC card and it is possible to restart the update processing at an optimum position.
The IC card according to still another aspect of this invention comprises a data storage region; a control information storage region; a saving region temporarily saving control information; and a processing region. When the processing section receives a command to write data from a host apparatus, it moves the control information stored in the control information storage region to the saving region, sets a status bit corresponding to a write processing at a processing start state, searches a data update place from the control information, stores write data included in the command in the searched update place, updates the update place for the data stored as the control information to a next data region, sets the status bit at a processing end state, and transmits a response message indicating that the processing was normally ended to the host apparatus; and in restarting the IC card after the write processing is interrupted, the processing section judges whether to restore the control information transmitted to the host apparatus in accordance with the state of the status bit.
According to the above-mentioned aspect, if the supply of power (to the contact IC card) or the supply of radio wave (to the non-contact IC card) is stopped for some reason, for example, the host apparatus automatically transmits a restart command when the IC card is restarted and the IC card which receives the restart command restores or holds the control information in accordance with the place where the supply of power was stopped. Thus, no contradiction in recognition occurs between the host apparatus and the IC card and it is possible to normally restore the data and message relating to the interrupted update processing.
The IC card according to still another aspect of this invention comprises a data storage region; a saving region temporarily saving data from a host apparatus; a status bit storage region storing a status bit indicating a processing state; and a processing section. When the processing section receives a command to write the data from the host apparatus, it moves the data stored in the data storage region to the saving region, sets the status bit corresponding to a write processing at a processing start state, writes data included in the command to the data storage region, sets the status bit at a processing end state, and transmits a response message indicating that the processing was normally ended to the host apparatus; and in restarting the IC card after the write processing is interrupted, the processing section judges whether to restore the data region in accordance with the state of the status bit.
According to the above-mentioned aspect, if the supply of power (to the contact IC card) or the supply of radio wave (to the non-contact IC card) is stopped for some reason, for example, the host apparatus automatically transmits the restart command when the IC card is restarted and the IC card which receives the restart command restores or holds the data region in accordance with the place where the supply of power was stopped. Thus, no contradiction in recognition occurs between the host apparatus and the IC card and it is possible to normally restore the data and message relating to the interrupted update processing.
The data update control method according to still another aspect of this invention comprises a first write step of, if receiving a first command to write data without guarantee from externally, setting the status bit corresponding to a write processing at a state indicating a non-guarantee write processing and writing the received data to a data non-guarantee storage region; and a second write step of, if receiving a second command to write data with guarantee from externally, setting the status bit corresponding to the write processing at a state indicating a guarantee write processing and writing the received data to a data guarantee region.
According to the above-mentioned aspect, one of xe2x80x9cthe data guarantee regionxe2x80x9d and xe2x80x9cthe data non-guarantee regionxe2x80x9d is designated using a predetermined command, thereby guaranteeing important data relating to operations between the host apparatus and the IC card. Thus, even if the supply of power (to the contact IC card) or the supply of radio wave (to the non-contact IC card) is stopped for some reason, for example, it is possible to normally restore the processing executed until the operation of the IC card was stopped when restarting the IC card.
The data update control method according to still another aspect of this invention comprises a first status setting step of, if receiving a command to write data from a host apparatus, setting a status bit corresponding to a write processing at a processing start state; a second status setting step of setting the status bit at a processing end state after finishing writing the data based on control information; a response transmission step of transmitting a response message indicating that the write processing was normally ended to externally; and a restart step of, in restarting after the write processing is interrupted, transmitting an error signal to the host apparatus if the status bit is set at the processing start state, and transmitting the response message indicating processing end to externally if the status bit is set at the processing end state.
According to the above-mentioned aspect, if the supply of power (to the contact IC card) or the supply of radio wave (to the non-contact IC card) is stopped for some reason, for example, the IC card notifies the host apparatus of xe2x80x9cinformation indicating that a previous processing resulted in an errorxe2x80x9d or xe2x80x9cinformation indicating that the previous processing was normally endedxe2x80x9d when the IC card is restarted. Thus, no contradiction in recognition occurs between the host apparatus and the IC card. Further, if the status bit represents a normal end state, it is possible to normally restore the data and message relating to the processing when the IC card was interrupted.
The data update control method according to still another aspect of this invention comprises a saving step of, if receiving a command to write data from externally, moving restart point information to a saving region; a first status setting step of setting a status bit corresponding to a write processing at a processing start state; a restart point setting step of updating current restart point information to a command serial number included in the command; a data write step of wiring the data included in the command to a predetermined data storage region; a second status setting step of setting the status bit at a processing end state after ending writing the data; a response transmission step of transmitting a response message indicating that the processing was normally ended to externally; and a restart step of, in restarting after the write processing is interrupted, notifying the status bit and restart point processed in accordance with the state of the status bit as the response message.
According to the above-mentioned aspect, if the supply of power (to the contact IC card) or the supply of radio wave (to the non-contact IC card) is stopped for some reason, for example, the host apparatus automatically transmits a restart command when restarting the IC card and the IC card which receives the restart command notifies the host apparatus of the processing status and the restart point information in accordance with the place where the supply of power was stopped. Thus, no contradiction in recognition occurs between the host apparatus and the IC card and it is possible to restart the update processing at an optimum position.
The data update control method according to still another aspect of this invention comprises a saving step of, if receiving a command to write data from externally, moving present control information to a saving region; a first status setting step of setting a status bit corresponding to a write processing at a processing start state; a search step of searching a data update place from the control information; a data storage step of storing write data included in the command in the searched update place; a control information update step of updating the update place for the data stored as control information to a next data region; a second status setting step of setting the status bit at a processing end state; a response setting step of transmitting a response message indicating that the processing was normally ended to externally; and a restart step of, in restarting after the write processing is interrupted, judging whether to restore the control information transmitted to externally in accordance with the state of the status bit.
According to the above-mentioned aspect, if the supply of power (to the contact IC card) or the supply of radio wave (to the non-contact IC card) is stopped for some reason, for example, the host apparatus automatically transmits a restart command when the IC card is restarted and the IC card which receives the restart command restores or holds the control information in accordance with the place where the supply of power was stopped. Thus, no contradiction in recognition occurs between the host apparatus and the IC card and it is possible to normally restore the data and message relating to the interrupted update processing.
The data update control method according to still another aspect of this invention comprises a saving step of, if receiving a command to write data from externally, moving data stored in a data storage region to a saving region; a first status setting step of setting a status bit corresponding to a write processing at a processing start state; a data write step of writing data included in the command to a data storage region; a second status setting step of setting the status bit at a processing end state; a response transmission step of transmitting a response message indicating that the processing was normally ended to externally; and a restart step of, in restarting after the write processing is interrupted, judging whether to restore the data region in accordance with the state of the status bit.
According to the above-mentioned aspect, if the supply of power (to the contact IC card) or the supply of radio wave (to the non-contact IC card) is stopped for some reason, for example, the host apparatus automatically transmits the restart command when the IC card is restarted and the IC card which receives the restart command restores or holds the data region in accordance with the place where the supply of power was stopped. Thus, no contradiction in recognition occurs between the host apparatus and the IC card and it is possible to normally restore the data and message relating to the interrupted update processing.
The data/message restoration control method according to still another aspect of this invention comprises a first command transmission step in which a host apparatus transmits a command to write data; a first status setting step in which an IC card sets a status bit corresponding to a write processing at a processing start state based on the received command; a second status setting step in which the IC card sets the status bit at a processing end state after finishing writing the data based on the control information; a response transmission step in which the IC card transmits a response message indicating that the processing was normally ended to the host apparatus; a second command transmission step in which the host apparatus retransmits the command to write data if the write processing is interrupted and the host apparatus receives no response from the IC card; and a data/message restoration step in which the IC card receives the retransmitted command, prohibits the write processing and transmits an error signal to the host apparatus if the status bit is set at the processing start state, and transmits the response message to the host apparatus after restoring the data and the response message indicating the processing end by means of a rewrite processing if the status bit is set at the processing end state.
According to the above-mentioned aspect, if the supply of power (to the contact IC card) or the supply of radio wave (to the non-contact IC card) is stopped for some reason, for example, the IC card notifies the host apparatus of xe2x80x9cinformation indicating that a previous processing resulted in an errorxe2x80x9d or xe2x80x9cinformation indicating that the previous processing was normally endedxe2x80x9d when the IC card is restarted. Thus, no contradiction in recognition occurs between the host apparatus and the IC card. Further, if the status bit represents a normal end state, it is possible to normally restore the data and message relating to the processing when the IC card was interrupted.
The data/message restoration control method according to still another aspect of this invention comprises a first command transmission step in which a host apparatus transmits a command to write data; a saving step in which an IC card moves restart point information to a saving region based on the received command; a first status setting step of setting a status bit corresponding to a write processing at a processing start state; a restart point setting step of updating the present restart point information to a command serial number included in the command; a data write step of writing data included in the command to a predetermined data storage region; a second status setting step of setting the status bit at a processing end state after ending writing the data; a response transmission step of transmitting a response message indicating that the processing was normally ended, to the host apparatus; a restart command transmission step in which the host apparatus transmits a restart command when restarting the IC card if the write processing is interrupted and the host apparatus receives no response; a restart point transmission step in which the IC card notifies the host apparatus of the status bit and a restart point processed in accordance with the state of the status bit as the response message; a second command transmission step in which the host apparatus transmits a data write command corresponding to the received restart point; and a data/message restoration step in which the IC card receives the command and restores the data and the response message indicating processing end by means of a rewrite processing.
According to the above-mentioned aspect, if the supply of power (to the contact IC card) or the supply of radio wave (to the non-contact IC card) is stopped for some reason, for example, the host apparatus automatically transmits a restart command when restarting the IC card and the IC card which receives the restart command notifies the host apparatus of the processing status and the restart point information in accordance with the place where the supply of power was stopped. Thus, no contradiction in recognition occurs between the host apparatus and the IC card and it is possible to restart the update processing at an optimum position.
The data/message restoration control method according to still another aspect of this invention comprises a first command transmission step in which a host apparatus transmits a command to write data; a saving step in which an IC card moves present control information to a saving region based on the received command; a first status setting step of setting a status bit corresponding to a write processing at a processing start state; a search step of searching a data update place from the control information; a data storage step of storing write data included in the command, in the searched update place; a control information update step of updating the update place for the data stored as the control information to a next data region; a second status setting step of setting the status bit at a processing end state; a response setting step of transmitting a response message indicating that the processing was normally ended to the host apparatus; a restart command transmission step in which the host apparatus transmits a restart command when the IC card is restarted if the write processing step is interrupted and the host apparatus receives no response from the IC card; judgment result transmission step in which the IC card judges whether to restore the control information transmitted to the host apparatus in accordance with the state of the status bit after receiving the restart command, and transmitting a judgment result to the host apparatus as the response message; a second command transmission step in which the host apparatus transmits a data write command corresponding to the received judgment result; and a data/message restoration step in which the IC card receives the command and restores the data and the response message indicating processing end by means of a rewrite processing.
According to the above-mentioned aspect, if the supply of power (to the contact IC card) or the supply of radio wave (to the non-contact IC card) is stopped for some reason, for example, the host apparatus automatically transmits a restart command when the IC card is restarted and the IC card which receives the restart command restores or holds the control information in accordance with the place where the supply of power was stopped. Thus, no contradiction in recognition occurs between the host apparatus and the IC card and it is possible to normally restore the data and message relating to the interrupted update processing.
The data/message restoration control method according to still another aspect of this invention comprises a first command transmission step in which a host apparatus transmits a data write command; a saving state in which an IC card moves data stored in a data storage region to a saving region based on the received command; a first status setting step in which the IC card sets a status bit corresponding to a write processing at a processing start state; a data write step in which the IC card writes data included in the command to the data storage region; a second status setting step in which the IC card sets the status bit at a processing end state; a response transmission step in which the IC card transmits a response message indicating a processing was normally ended to the host apparatus; in restarting if sad write processing is interrupted and the host apparatus receives no response from the IC card, a restart command transmission step in which the host apparatus transmits a restart command; a judgment result transmission step in which the IC card judges whether to restore the data region in accordance with a state of the status bit after receiving the restart command, and transmits a judgment result to the host apparatus as the response message; a second update command transmission step in which the host apparatus transmits the data write command corresponding to the received judgment result; and a data/message restoration step in which the IC card receives the command and restores the data and the response message indicating processing end by means of a rewrite processing.
According to the above-mentioned aspect, if the supply of power (to the contact IC card) or the supply of radio wave (to the non-contact IC card) is stopped for some reason, for example, the host apparatus automatically transmits the restart command when the IC card is restarted and the IC card which receives the restart command restores or holds the data region in accordance with the place where the supply of power was stopped. Thus, no contradiction in recognition occurs between the host apparatus and the IC card and it is possible to normally restore the data and message relating to the interrupted update processing.
The computer readable medium stores a computer program which when executed realizes the methods according to the present invention.
Other objects and features of this invention will become apparent from the following description with reference to the accompanying drawings.